package com.csun.cmny.provider.service.impl;

import com.csun.cmny.provider.dao.SetMealExpItemMapper;
import com.csun.cmny.provider.dao.SetMealMapper;
import com.csun.cmny.provider.pojo.Oldman;
import com.csun.cmny.provider.pojo.SetMeal;
import com.csun.cmny.provider.pojo.SetMealExpItem;
import com.csun.cmny.provider.service.SetMealService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service("SetMealService")
public class SetMealServiceImpl implements SetMealService {
    @Resource
    SetMealMapper setMealMapper;
    @Resource
    SetMealExpItemMapper setMealExpItemMapper;

    @Override
    public int insert(SetMeal setMeal) {
        return setMealMapper.insertSelective(setMeal);
    }

    @Override
    public int deleteById(Integer setMealId) {
        return setMealMapper.deleteByPrimaryKey(setMealId);
    }

    @Override
    public int updateById(SetMeal setMeal) {
        return setMealMapper.updateByPrimaryKeySelective(setMeal);
    }

    @Override
    public int insertBatch(List<SetMealExpItem> setMealExpItemList) {
        return setMealExpItemMapper.insertBatch(setMealExpItemList);
    }

    @Override
    public int deleteBySetMealExpItem(SetMealExpItem setMealExpItem) {
        return setMealExpItemMapper.deleteBySetMealExpItem(setMealExpItem);
    }

    @Override
    public SetMeal selectBySetMeal(SetMeal setMeal) {
        return setMealMapper.selectBySetMeal(setMeal);
    }

    @Override
    public SetMeal selectById(Integer setMealId) {
        return setMealMapper.selectById(setMealId);
    }

    @Override
    public List<SetMeal> showAll(Map<String, Object> queryMap) {
        return setMealMapper.showAll(queryMap);
    }

    @Override
    public List<Map<String, Object>> selectByItemId(Integer itemId) {
        return setMealExpItemMapper.selectByItemId(itemId);
    }

    @Override
    public List<SetMeal> selectByList(List<Integer> integerList) {
        return setMealMapper.selectByList(integerList);
    }

    @Override
    public int updateBatch(List<Map<String, Object>> mapList) {
        return setMealExpItemMapper.updateBatch(mapList);
    }

    @Override
    public int updateSMBatch(List<SetMeal> setMealList) {
        return setMealMapper.updateSMBatch(setMealList);
    }

    @Override
    public List<SetMeal> getMealsByExpensectrType(Map<String,Object> query) {
        return setMealMapper.getMealsByExpensectrType(query);
    }

    @Override
    public List<Map<String, Object>> isMealBeUsed(Integer setMealId,Integer groupId) {
        return setMealMapper.isMealBeUsed(setMealId,groupId);
    }

    @Override
    public List<SetMealExpItem> findBySetMealId(Integer setMealId) {
        return setMealExpItemMapper.findBySetMealId(setMealId);
    }
}
